快捷路由
快捷路由
快捷路由允许你快速给控制器注册路由,并且针对不同的请求类型可以设置方法前缀,例如:
// 给User控制器设置快捷路由Route::controller('user','index/User');
User控制器定义如下:
phpnamespace app\index\controller;class User{public function getInfo(){}public function getPhone(){}public function postInfo(){}public function putInfo(){}public function deleteInfo(){}}
我们可以通过下面的URL访问
get http://localhost/user/infoget http://localhost/user/phonepost http://localhost/user/infoput http://localhost/user/infodelete http://localhost/user/info